#include "CWorker.h"

namespace csmodel
{
    //=================================

    void CWorker::Draw( IDrawEngine & di ) const
    {
        QString s;
        QTextStream ss( &s );
        ss << Name() << Id() /*<< " :" << EmptyBlockId()*/;

        QRect b( Bounds() );
        QRect head( Bounds().x()+12, Bounds().y()+5, 8, 8 );
        di.Ellipse( head );                                                                                                  //head
        di.Line( QPoint( head.center().x()+1, Bounds().y()+12 ), QPoint( head.center().x()+1, Bounds().y()+22 ) );           //body
        di.Line( QPoint( head.center().x()-6, Bounds().y()+16 ), QPoint( head.center().x()+7, Bounds().y()+16 ) );           //hands
        di.Line( QPoint( head.center().x()+5, head.center().y()+20 ), QPoint( head.center().x()+1, head.center().y()+12 ) ); //left leg
        di.Line( QPoint( head.center().x()-5, head.center().y()+20 ), QPoint( head.center().x()+1, head.center().y()+12 ) ); //right leg

        QPoint c( b.center() );
        c.setX( b.center().x() - 5*ss.string()->length()/2 );
        c.setY( c.y() - b.height()/2 );
        di.OutText( c, 10, s );
    }

    //---------------------------------

    ClassVisualTraits * CWorker::visualTraits = 0;

    //---------------------------------

    void CWorker::GetProperties( CProperties * map )
    {
        inherited::GetProperties( map );
        map->erase( "Width" );
        map->erase( "Height" );
    }

} // namespace csmodel
